package org.cdc.divination.frame.data.type;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

import java.util.stream.Collectors;

public class PlayerType implements FormatType {
    @Override
    public boolean checkData(String data) {
        return Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()).contains(data);
    }

    @Override
    public Object parseData(String data) {
        return Bukkit.getPlayer(data);
    }

    @Override
    public Object defaultData() {
        return null;
    }
}
